<?php
/**
 * Created by laoyu.
 * User: hilaoyu@qq.com
 * Date: 2018/5/22
 * Time: 17:11
 */

namespace Hilaoyu\LaravelExtend\Providers;

use Hilaoyu\Utils\Sms;
use Illuminate\Support\ServiceProvider  as BaseServiceProvider;

class SmsServiceProvider extends BaseServiceProvider
{
    public function boot()
    {
        $this->publishes([
            $this->configPath() => config_path('sms.php'),
        ]);
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        $this->mergeConfigFrom($this->configPath(), 'sms');
        $this->app->singleton('sms', function ($app) {
            return Sms::make(config('sms.driver'),config('sms.config'));
        });

    }

    protected function configPath()
    {
        return dirname(__DIR__) . '/Services/Sms/config/sms.php';
    }
}
